package com.itheima.类加载与反射.反射.案例一;

import java.lang.reflect.Constructor;

public class 测试1 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException {
        Class c = Class.forName("com.itheima.类加载与反射.反射.案例一.Student");
        Constructor[] constructors = c.getConstructors();
        //返回公共构造方法
        for (Constructor constructor : constructors) {
            System.out.println(constructor);
        }
        //返回所有构造方法
        Constructor[] declaredConstructors = c.getDeclaredConstructors();
        for (Constructor declaredConstructor : declaredConstructors) {
            System.out.println(declaredConstructor);
        }
        //返回指定单个公共构造方法
        Constructor declared1 = c.getDeclaredConstructor(String.class, int.class);
        Constructor declared = c.getDeclaredConstructor();
        System.out.println(declared1);
        System.out.println(declared);

    }
}
